package com.hj.dapp.common.util;

import cn.hutool.extra.pinyin.PinyinUtil;
import org.apache.commons.lang3.RandomUtils;

import java.util.Arrays;

/**
 * @author 胡奥程
 * @version 1.0
 * @date 2024/1/22
 */
public class BrandUtil {
    public static String generateBrandCode(String name) {
        String code = RandomUtils.nextInt(1000, 2000) + "";
        return Arrays.stream(PinyinUtil.getPinyin(name).split(" "))
                .reduce("", (a, b) -> a += b.substring(0, 1).toUpperCase())+code;

    }
}
